package com.atguigu.my.chapter02

/**
 *
 * @description: xxx
 * @time: 2020-05-22 14:35
 * @author: baojinlong 
 **/
object ExeDemo01 {
  def main(args: Array[String]): Unit = {
    println("结果是" + fbn(10))
    println("结果是" + f2(3))
  }

  def fbn(n: Int): Int = {
    if (n == 1 || n == 2) {
      1
    } else {
      fbn(n - 1) + fbn(n - 2)
    }
  }

  def f2(n: Int): Int = {
    if (n == 1) {
      3
    } else {
      2 * f2(n - 1) + 1
    }
  }

  def peach(day: Int): Int = {
    if (day == 10) {
      1
    } else {
      (peach(day + 1) + 1) * 2
    }
  }
}
